const express = require('express');
const router = express.Router();
const fs = require('fs');
const path = require('path');
const query = require('../conn/conn');
const sendMail = require('../library/sendMail');

router.get('/all', async (req, res, next) => {
    let result = await query('select * from commodity');
    res.send(result);
});

router.get('/all_id', async (req, res, next) => {
    let result = await query(`select * from commodity where id =${req.query.id} `);
    res.send(result);
});

router.get('/all_ids', async (req, res, next) => {
    let idList = req.query['idList'];

    let result = await query(`select * from commodity where id in (${idList})`);

    res.send(result);
});
module.exports = router;
